package com.xu.cloud.common.util;

import org.bouncycastle.jce.provider.BouncyCastleProvider;

import java.security.Provider;

/**
 * 创建java.security.Provider工具类
 *
 * @author xuguan
 * @since 2024/7/3
 */
public class Providers {
    public static Provider createBouncyCastleProvider() {
        try {
            return ProviderFactory.newBouncyCastleProvider();
        } catch (NoClassDefFoundError | NoSuchMethodError e) {
            return null;
        }
    }

    private static class ProviderFactory {
        private static Provider newBouncyCastleProvider() {
            return new BouncyCastleProvider();
        }
    }
}
